<template>
	<div>
		<AplidForm v-bind="formConfig" v-model="formModel" @submit="onSubmit"></AplidForm>
	</div>
</template>

<script setup lang="ts">
import { formConfig } from '@/views/system/user/govUser/config'
import { getStore } from '@/utils/store'
import apiMod from '@/apiMod'

const emit = defineEmits(['refresh'])
const userInfo = getStore('userInfo') || {}
const formModel = ref({
	organizationName: userInfo.organizationName,
})
console.log(userInfo, 'userInfo')
const onSubmit = (form, done) => {
	apiMod
		.sys_user_add({
			classifyId: 3,
			authProvince: userInfo.authProvince,
			authCity: userInfo.authCity,
			authArea: userInfo.authArea,
			authStreet: userInfo.authStreet,
			authCommunity: userInfo.authCommunity,
			...form,
		})
		.then((res) => {
			ElMessage.success('操作成功')
			emit('refresh')
			done()
		})
		.catch(() => {
			done()
		})
}
</script>

<style scoped></style>
